{{ define "index.html"}}
<!DOCTYPE html>
<html lang="en">
<head>
  <link rel="shortcut icon" href="http://149.127.204.249:8000/favicon.ico" type="image/x-icon" />
  <title>Chatbot-demo</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://libs.baidu.com/jquery/2.0.0/jquery.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>
<body>

<div class="container">
  <h1 class="name">Chatbot</h1>
  <style>
    .name{
        text-align: center;
    }
    .name2{
        text-align: center;
        color: burlywood;
    }
    .name3{
      text-align: center;
      color: royalblue;
    }
    .btn {
        width: 100px;
        text-align: center;
    }
  </style>
  <script type="text/javascript"> 
      function getValue() {
        let ask = document.getElementById("put").value;
        axios({       //使用axios来传输数据，用Gin-template模板是为了解决前后端跨域请求的问题
          method: 'post',//提交方法
          url: 'http://127.0.0.1:8082/sub',//提交后端地址
          params: {   //数据方式 params格式
          ask,
          }
          }).then((res) => {
          console.log(res);    //控制台打印测试数据
          })
        document.getElementById("put").value="";  //清理input数据
      }
  </script>

  <p class="name2">chatgpt测试小demo,实现原理调用apikey,可能text-davinci-003相对原版chatgpt有点点小误差</p>
  <p class="name3">不要问一些无意义的问题,不要浪费我的token,token失效后，我会实时更新，本站永远免费！！！</p>
  
  <form onsubmit="return false" method="post" action="/sub">
    <br>
    <br>
    <div class="input-group">
        <div class="custom-file">
          <input id="put" type="text" class="form-control" placeholder="你可以向AI提出任何问题"  name="message">
        </div>
  
        <div >
          <button class="btn btn-warning" type="submit" onclick="getValue()">提问</button>
        </div>
      </div>

    <br>
    
 <div>
  <iframe src="/main" width="1000" height="600" frameborder="0">  //内嵌网页
  </iframe>
 </div>
  </form>
</div>
</body>
</html>
{{end}}